#include <time.h>
#include <stdio.h>
#include <locale.h>
#include <string.h>
//
// Created by jsjxsy on 2022/6/30.
//
int main(void) {
  time_t currtime;
  struct tm *timer;
  char buffer[80];

  time(&currtime);
  timer = localtime(&currtime);

  printf("Locale is: %s\n", setlocale(LC_ALL, "en_GB.UTF-8"));
  strftime(buffer, 80, "%c", timer);
  printf("Date is: %s\n", buffer);

  printf("Locale is: %s\n", setlocale(LC_ALL, "de_DE.UTF-8"));
  strftime(buffer, 80, "%c", timer);
  printf("Date is: %s\n", buffer);

  strftime(buffer, 80, "%Y-%m-%d %H:%M:%S", timer);
  printf("格式化的日期 & 时间 : |%s|\n", buffer);

  setlocale(LC_MESSAGES, "zh_CN.UTF-8");
  printf("\n按音序排序：");

  char str1[15];
  char str2[15];
  int ret;

  strcpy(str1, "abc");
  strcpy(str2, "ABC");

  ret = strcoll(str1, str2);

  if (ret > 0) {
    printf("str1 大于 str2");
  } else if (ret < 0) {
    printf("str2 小于 str1");
  } else {
    printf("str1 等于 str2");
  }

  return 0;
}

